package cn.flexui.flexuiserver.service.impl;

import cn.flexui.flexuiserver.domain.entity.BaseEntity;
import cn.flexui.flexuiserver.domain.entity.PromptTemplate;
import cn.flexui.flexuiserver.mapper.PromptTemplateMapper;
import cn.flexui.flexuiserver.service.PromptTemplateService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 提示词模板 服务实现类
 * </p>
 *
 * @author apeto
 * @since 2024-09-17 07:08:21
 */
@Service
public class PromptTemplateServiceImpl extends ServiceImpl<PromptTemplateMapper, PromptTemplate> implements PromptTemplateService {

    @Override
    public List<PromptTemplate> selectByUserId(long userId) {
        return list(new LambdaQueryWrapper<PromptTemplate>().eq(PromptTemplate::getUserId, userId).orderByDesc(BaseEntity::getId));
    }
}
